import request from '@/utils/request';

// 充值列表
export async function payAmountList(data) {
  const res = await request.post('/pay/payAmount', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 新增充值
export async function addPayAmount(data) {
  const res = await request.post('/pay/addPayAmount', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 编辑

export async function editPayAmount(data) {
  const res = await request.post('/pay/editPayAmount', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 需改状态
export async function setStatus(data) {
  const res = await request.post('/pay/setStatus', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function rechargeOrder(data) {
  const res = await request.post('/rechargeOrder', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
